-----------------------------------	
-- Area: Valkurm Dunes	
-- NPC:  Field Manual	
-----------------------------------	
	
require("/scripts/globals/settings");	
require("/scripts/globals/fieldsofvalor");	
require("scripts/globals/keyitems");
	
-----------------------------------	
-- onTrigger Action	
-----------------------------------	
	
function onTrigger(player,npc)
	local npc = GetNPCByID(17199750); -- Spawn ???
	if(player:hasKeyItem(MOOGLE_KEY) == true) then-- has moogle key  move NPC
	player:messageSpecial(6391,4306);
	npc:setPos(player:getXPos(),player:getYPos(),player:getZPos());
	npc:setStatus(0);
	elseif(player:hasKeyItem(MOOGLE_KEY) == false) then-- has no moogle key, dont move
	player:messageSpecial(6391,4306);
	end
end;	
	
-----------------------------------	
-- onTrade Action	
-----------------------------------	
	
function onTrade(player,npc,trade)
		if (trade:hasItemQty(4306,1) and (player:hasKeyItem(MOOGLE_KEY) == false)) then -- donko trade I want key item
			player:addKeyItem(MOOGLE_KEY);
			player:messageSpecial(6394,1184);
			player:messageSpecial(6403,4306);		
		elseif (trade:hasItemQty(4306,1) and (player:hasKeyItem(MOOGLE_KEY) == true)) then -- donko trade I want key item
			player:delKeyItem(MOOGLE_KEY);
			player:messageSpecial(6395,1184); 
			player:messageSpecial(6403,4306);
	    end		
end;	
	
-----------------------------------	
-- onEventSelection	
-----------------------------------	
	
function onEventUpdate(player,csid,menuchoice)	
	updateFov(player,csid,menuchoice,7,8,9,10,57);
end;	
	
-----------------------------------	
-- onEventFinish Action	
-----------------------------------	
	
function onEventFinish(player,csid,option)	
	finishFov(player,csid,option,7,8,9,10,57,FOV_MSG_VALKURM);
end;	
